<?php

class DStatus 
{
    const TYPE_IMAGE = 0;
    const TYPE_MOVIE = 1;
    
    const TEMP = -1;
    const UNDEFINED = 0;    // udnefined "]
    const FRESH = 5;        // świeżo dodany
    const NORMAL = 10;      // demot opublikowany   
    const QUEUE = 30;       // w poczekalni
    const BAD = 40;         // jakis problem zgloszony przez link (np. zgloszenie naruszenia praw)
    
    const FILTER_TOP        = 555;
    const FILTER_ADULTS     = 666;
    const FILTER_RANDOM     = 777;
    
    
    
    public static function getString($id_statuses)
    {
        $id_statuses = intval($id_statuses);
        
        switch ($id_statuses)
        {
            case DStatus::UNDEFINED: $str = "UNDEFINED"; break;
            case DStatus::FRESH:     $str = "FRESH"; break;
            case DStatus::NORMAL:    $str = "NORMAL"; break;            
            case DStatus::QUEUE:     $str = "QUEUE"; break;
            case DStatus::BAD:       $str = "BAD"; break;
            case DStatus::TEMP:       $str = "TEMP"; break;
            default: $str = "ZŁY ID!";
        }
        return $str;
    }
    
    public static function getTypeString($id_type)
    {
        $id_type = intval($id_type);
        
        switch ($id_type)
        {
            case DStatus::TYPE_IMAGE: $str="IMAGE"; break;
            case DStatus::TYPE_MOVIE: $str="MOVIE"; break;
            default: $str="ERROR";
        }
        
        return $str;
    }
    
    public static function getTypeArray()
    {
        return array(
            DStatus::TYPE_IMAGE => "IMAGE",
            DStatus::TYPE_MOVIE => "MOVIE"            
        );
    }
    
    public static function getArray()
    {
        return array(
            DStatus::UNDEFINED  => 'UNDEFINED',
            DStatus::FRESH      => 'FRESH',
            DStatus::NORMAL     => 'NORMAL',          
            DStatus::QUEUE      => 'QUEUE',
            DStatus::TEMP       => 'TEMP',
            DStatus::BAD        => 'BAD');
    }
    
    // ta funkcja okresla czy istnieje demot
    // dla podanych statusow (brak statusow dost. tylko dla adm)
    public static function exist($id_statuses)
    {
        $id = intval($id_statuses);
        
        switch ($id)
        {            
            case DStatus::UNDEFINED: $str = "UNDEFINED"; break;        
            case DStatus::NORMAL:    $str = "NORMAL"; break;      
            case DStatus::QUEUE:     $str = "QUEUE"; break;          
            case DStatus::TEMP:      $str = "TEMP"; break;  
            default: return false;
        }
        
        return $str;    
        
    }
}

?>
